#include "clueCardParam.h"
#include "jsonUtils.h"

ClueCardParam::ClueCardParam() : doc(rapidjson::kObjectType),clueCardId(0),channel(0)
{
}

ClueCardParam::ClueCardParam(const int64_t& clueCardId, const int& channel) : doc(rapidjson::kObjectType),clueCardId(clueCardId),channel(channel)
{
}

JsonDoc& ClueCardParam::jsonSerialize()
{
	doc.AddMember(L"clueCardId", clueCardId, doc.GetAllocator());
	doc.AddMember(L"channel", channel, doc.GetAllocator());
	return doc;
}

JsonDoc& ClueCardParam::jsonDeserialize(const String& json)
{
	doc.Parse(json.c_str());
	if (!json.empty()) {
		JsonUtils::loadLong(doc, L"clueCardId", clueCardId);
		JsonUtils::loadInt(doc, L"channel", channel);
	}
	return doc;
}

String ClueCardParam::jsonStr()
{
	jsonSerialize();
	return JsonUtils::jsonStr(doc);
}

const int64_t& ClueCardParam::getClueCardId() const
{
	return clueCardId;
}

const int& ClueCardParam::getChannel() const
{
	return channel;
}
